package cn.iocoder.yudao.module.english.dal.mysql.reward;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.english.controller.admin.reward.vo.RewardConfigurationPageReqVO;
import cn.iocoder.yudao.module.english.dal.dataobject.reward.RewardConfigurationDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 奖励配置 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface RewardConfigurationMapper extends BaseMapperX<RewardConfigurationDO> {

    default PageResult<RewardConfigurationDO> selectPage(RewardConfigurationPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<RewardConfigurationDO>()
                .eqIfPresent(RewardConfigurationDO::getSort, reqVO.getSort())
                .eqIfPresent(RewardConfigurationDO::getBusinessType, reqVO.getBusinessType())
                .eqIfPresent(RewardConfigurationDO::getJudgmentCriteriaContent, reqVO.getJudgmentCriteriaContent())
                .eqIfPresent(RewardConfigurationDO::getRewardAmount, reqVO.getRewardAmount())
                .eqIfPresent(RewardConfigurationDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(RewardConfigurationDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(RewardConfigurationDO::getId));
    }

}